#!/bin/bash

echo "------------------------------"
env
echo "------------------------------"

dsn=postgres://$DB_USERNAME:$DB_PASSWORD@$DB_HOST:$DB_PORT/$DB_DATABASE?sslmode=
if [ "$SSL_MODE" -eq 1 ]; then
    dsn=$dsn"enable"
else
    dsn=$dsn"disable"
fi

echo "dsn:"$dsn
DSN=`./qp --mode encrypt --dsn $dsn`


./qp --mode ${QP_MODE} --dsn ${DSN} --host ${QP_HOST}  --data ${LOCAL_DATA} --key-path ${KEY_PATH} --cert-path ${CERT_PATH}